package com.qf.demo;

/**
 * projectName: Demo1
 *
 * @author dongshihao
 * Date:2021/9/22   12:12
 * description:双向链表
 */
public class Demo3 {

    public static void main(String[] args) {
        Node<Integer> top = new Node<>();
        //构建双向链表
        Node p = top;
        for (int i = 1; i < 10; i++) {
            p.value = i;
            if (i!=9){
                p.next = new Node();
                p.next.prev = p;
                p=p.next;
            }
        }
        System.out.println(p.prev.value);

        //删除元素




        //新增元素
    }

    /**
     * 双向链表
     * @param <T>
     */
    static class Node<T>{
        T value;
        Node<T> next;
        Node<T> prev;
    }
}
